package com.changgou.goods.feign;


import com.changgou.entity.QueryPageBean;
import com.changgou.entity.Result;
import com.changgou.goods.pojo.Spu;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(name = "goods")
public interface SpuFeign {

    @GetMapping("/spu/findSpuById/{id}")
    Result<Spu> findSpuById(@PathVariable("id") String id);

    //查询回收站商品
    @RequestMapping("/spu/findReGoods")
    Result findReGoods();

    //回复购物车商品
    @PutMapping("/spu/restore/{id}")
    Result restore(@PathVariable("id") String id);

//    //分页查询
//    @RequestMapping("/spu/findPage/{page}/{size}")
//    Result findPageGoods(@PathVariable("page") int page, @PathVariable("size") int size);

    //从数据库删除该商品
    @DeleteMapping("/spu/realDel/{id}")
    Result realDel(@PathVariable("id") String id);

    //逻辑删除, 逻辑删除将isDelete状态修改为1
    @DeleteMapping("/spu/{id}")
    Result delete(@PathVariable("id") String id);

    // 审核商品
    @PutMapping("/spu/audit/{id}/{status}")
    public Result audit(@PathVariable("id") String id, @PathVariable("status") String status);

    //    上架
    @PutMapping("/spu/marketable/{id}/{marketable}")
    public Result marketable(@PathVariable("id") String id, @PathVariable("marketable") String marketable);


    //分页查询
    @RequestMapping("/spu/findPage1")
    public Result findPage1(@RequestBody QueryPageBean queryPageBean);



    @RequestMapping("/spu/findReGoodsPage")
    public Result findReGoodsPage(@RequestBody QueryPageBean queryPageBean);

    //根据id‘查询数据
    @GetMapping("/spu/{id}")
    public Result findById(@PathVariable("id") String id);


//    void add(Spu spu);
}
